import React  from 'react'

export default (props) => {
    let {carts,tab}=props
    function changeTab(tab){
        props.onTab(tab)
    }
    return (
        <div className='cates'>
            {
                carts.map(ele=>(
                    <span 
                        onClick={()=>changeTab(ele.tab)}
                        key={ele.id}
                        className={tab==ele.tab?"on":""}
                        >{ele.label}
                    </span>
                ))
            }
        </div >
    )
}